package com.oazon.moco.playlist;

import java.util.List;
import java.util.Vector;

import com.oazon.moco.bean.Metadata;

public abstract class PlayList<T> {
	
	protected int historySize = 90;// 90
	protected int bufferSize = 10;// 10
	protected int dynamicSize = 100;// 100
	protected int maxSize = 500;// 500
	protected int writeIndex;// 用户指定列表位置（0~5000）
	protected int readIndex = 0;// 当前播放的媒体

	protected Vector<T> mPlayList = new Vector<T>();
	
	public abstract boolean add(T metaData);
	
	public abstract boolean addAll(List<T> metadatas);
	
	public abstract boolean addAll(int index, List<T> metadatas);
	
	public abstract boolean add(int index, T metaData);
	
	public abstract T remove(int location);
	
	public abstract T removeFirst();
	
	public abstract void clear();
	
	public abstract int indexOf(T metaData);
	
	public abstract Vector<T> getPlayList();
	
	public abstract int size();
	
	
	public int getHistorySize() {
		return historySize;
	}

	public void setHistorySize(int historySize) {
		this.historySize = historySize;
	}

	public int getBufferSize() {
		return bufferSize;
	}

	public void setBufferSize(int bufferSize) {
		this.bufferSize = bufferSize;
	}

	public int getDynamicSize() {
		return dynamicSize;
	}

	public void setDynamicSize(int dynamicSize) {
		this.dynamicSize = dynamicSize;
	}

	public int getMaxSize() {
		return maxSize;
	}

	public void setMaxSize(int maxSize) {
		this.maxSize = maxSize;
	}

	public int getWriteIndex() {
		return writeIndex;
	}

	public void setWriteIndex(int writeIndex) {
		this.writeIndex = writeIndex;
	}

	public int getReadIndex() {
		return readIndex;
	}

	public void setReadIndex(int readIndex) {
		this.readIndex = readIndex;
	}
	
	public Metadata get(int index) {
		if (mPlayList==null || index >= mPlayList.size() || index < 0)
			return null;
		
		return (Metadata) mPlayList.get(index);
	}
	
}
